﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HotelManagement.Common;
using HotelManagement.BL;

namespace HotelManagement.PL
{
    public partial class LoginForm : Form
    {

        private readonly string LOGIN_FAILD = "登陆失败";
        public LoginForm()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            LoginBL loginBL = new LoginBL();
            User user = new User();
            user.Name = txtUserName.Text.Trim();
            user.Password = txtPwd.Text.Trim();
            int nLogin = loginBL.Authorization(ref user);
            if ((int)ReturnType.FAILED == nLogin)
            {
                labWarning.Text = LOGIN_FAILD;
            }
            else 
            {
               this.DialogResult = DialogResult.OK;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
    }
}
